<template>
	<div class="paySet">
		<el-breadcrumb separator-class="el-icon-arrow-right" style="margin-bottom:15px;">
            <el-breadcrumb-item>结算支付管理</el-breadcrumb-item>
            <el-breadcrumb-item>支付设置</el-breadcrumb-item>
        </el-breadcrumb>
        <div class="payTop" style="font-size: 14px;margin-top: 30px;">
        	<p style="display: inline-block;vertical-align: top;margin-top: 0;">支付时间阈值：</p>
        	<div style="display: inline-block;width:250px;">
        		<el-input v-model.trim="timeoutDay" placeholder="请输入支付时间阈值" style="width:217px;"></el-input>天
        		<p style="line-height: 25px">发起付款后，超过设置的时间阈值无支付结果，数据进入支付超期预警池,0为不限制</p>
        	</div>
        	<div style="margin-left: 100px;margin-top: 15px;">
        		<el-button type="primary" @click="save">保存</el-button>
        	</div>
        </div>

	</div>	
</template>

<script>
	export default {
		data(){
			return {
				timeoutDay:""
			}
		},
		methods:{
			warn(msg){
				this.$message({
					showClose: true,
					message: msg,
					type: 'warning'
				});
			},
			save(){
				if(this.timeoutDay==""){
					this.warn("请输入支付时间阈值");
					return 
				}
				let reg=/^[0-9]\d*$/
				if(!reg.test(this.timeoutDay)){
					this.warn("请输入正确的支付时间阈值");
					return 
				}
				if(this.timeoutDay>30){
					this.warn("支付时间阈值不能大于30");
					return 
				}
				this.$confirm("是否保存数据？","提示",{
					confirmButtonText: '确定',
					cancelButtonText: '取消',
					type: 'warning'
				}).then(()=>{
					this.$axios.post("/kingdee/setting/updateTimeoutDay",{timeoutDay:this.timeoutDay}).then((res)=>{
						this.$message({
							message: '保存成功',
							type: 'success'
						});
	                })
				}).catch((error)=>{
					console.log(error)
				})
			},
			selectTimeout(){
				this.$axios.post("/kingdee/setting/selectTimeoutDay").then((res)=>{
                    this.timeoutDay=res;
                }).catch((error)=>{
                    console.log(error);
                })
			}
		},
		mounted(){
			this.selectTimeout();
		}
	}
</script>

<style>
	
</style>

